{extend name="../../admin/view/main"}

{block name="button"}
{if !empty($tableName) && $isParentCat == 0}
<!--{if auth("add")}-->
<button data-open='{:url("add")}{if !empty($cateId)}?get_cat_id={$cateId}&content_template_id={$contentTemplateId}{/if}' data-title="添加内容" class='layui-btn layui-btn-sm layui-btn-primary'>添加内容</button>
<!--{/if}-->
<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key};content_template_id#{$contentTemplateId}" class='layui-btn layui-btn-sm layui-btn-primary'>删除内容</button>
<!--{/if}-->
<!--{if auth("move_batch") && count($list)>0}-->
<button data-modal='{:url("move_batch")}' data-rule="id#{key};content_template_id#{$contentTemplateId};this_cat#{$cateId}"  data-title="批量移动" class='layui-btn layui-btn-sm layui-btn-normal'>批量移动</button>

<!--{/if}-->
{/if}
{/block}

{block name="content"}
{include file='article/article/form_style'}
<div class="think-box-shadow padding-0">
    {if !empty($tableName) && $isParentCat == 0}
        {include file='article/article/index_search'}
    {/if}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷新</button>
            </th>
            <th class='text-center nowrap' width="3%">ID</th>
            <th class='text-center nowrap' width="8%">所属栏目</th>
            <th class='text-center wrap' width="50%">内容标题</th>
            <th class='text-center nowrap' width="6%">是否推荐</th>
            <th class='text-center nowrap' width="6%">状态</th>

            <th class='text-center nowrap' width="10%">创建日期</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
            <td class='text-center nowrap'>
                {$vo.id}
            </td>
            <td class='text-center nowrap'>
                <a href="/index/article/list/id/{$vo.cate.id}.html" target="_blank">{$vo.cate.title|default='--'}</a>
            </td>
            <td class='text-left wrap'>
                {notempty name='vo.logo'}
                <img data-tips-image style="width:60px;height:60px" src="{$vo.logo|default=''}" class="layui-col-sm4 margin-right-5 text-top inline-block">
                {/notempty}
                <div class="inline-block layui-col-sm8">
                    <a href="/index/article/show/cat_id/{$vo.cat_id}/id/{$vo.id}.html" target="_blank">{$vo.title|default='--'}</a>
                </div>
            </td>

            <td class='text-center nowrap'>
                {if isset($vo.is_best) and $vo.is_best eq 1}
                        <!--{if auth("no_recommend")}-->
                    <a class="layui-btn layui-btn-sm" data-action="{:url('no_recommend')}" data-confirm="确定关闭首页推荐吗？" data-value="id#{$vo.id};is_best#0;content_template_id#{$contentTemplateId}">开启</a>
                        <!--{else}-->
                    <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-disabled">开启</a>
                        <!--{/if}-->
                {else}
                        <!--{if auth("to_recommend")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('to_recommend')}" data-confirm="确定开启首页推荐吗？" data-value="id#{$vo.id};is_best#1;content_template_id#{$contentTemplateId}">关闭</a>
                        <!--{else}-->
                    <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">关闭</a>
                        <!--{/if}-->
                {/if}
            </td>

            <td class='text-center nowrap padding-0 relative'>

                {if isset($vo.status) and $vo.status eq 1}
                <!--{if auth("forbid")}-->
                <a class="layui-btn layui-btn-sm" data-action="{:url('forbid')}" data-confirm="确定关闭首页推荐吗？" data-value="id#{$vo.id};status#0;content_template_id#{$contentTemplateId}">正常</a>
                <!--{else}-->
                <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-disabled">正常</a>
                <!--{/if}-->
                {else}
                <!--{if auth("resume")}-->
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-confirm="确定开启首页推荐吗？" data-value="id#{$vo.id};status#1;content_template_id#{$contentTemplateId}">停用</a>
                <!--{else}-->
                <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">停用</a>
                <!--{/if}-->
                {/if}

            </td>
            <td class='text-center nowrap'>{$vo.create_at}</td>
            <td class='text-right nowrap'>

                <div class="nowrap margin-bottom-5">
                    {if auth("edit")}
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}&get_cat_id={$cateId}&template_id={$templateId}&content_template_id={$contentTemplateId}'>编辑</a>
                    {else}
                    <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">修改</a>
                    {/if}

                    {if auth("remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除吗?" data-action="{:url('remove')}" data-value="id#{$vo.id};content_template_id#{$contentTemplateId}">删除</a>
                    {else}
                    <a data-tips-text="您无权限进行此操作！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">删除</a>
                    {/if}

                    {if auth("associated")}
                        {if empty($vo.associated)}
                            <a data-open='{:url("associated")}?article_id={$vo.id}&articleTable={$tableName}' data-title="关联设置" class='layui-btn layui-btn-sm layui-btn-primary'>添加关联</a>
                        {else}
                            <a data-open='{:url("associated_list")}?article_id={$vo.id}&articleTable={$tableName}' data-title="关联设置" class='layui-btn layui-btn-sm layui-btn-primary'>查看关联</a>
                        {/if}
                    {/if}

                    <a href="/index/article/show/cat_id/{$vo.cat_id}/id/{$vo.id}" class="layui-btn layui-btn-sm layui-btn-primary layui-border-black" target="_blank">浏览</a>

                </div>


            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>


    {if empty($tableName) && $isParentCat == 1}
        <span class="notdata layui-font-red">本栏目不可创建内容，如有需要创建内容请为此栏目设置内容模型</span>
    {else}
        {empty name='list'}<span class="notdata">No record</span>{else}{$pagehtml|raw|default=''}{/empty}
    {/if}

</div>
{/block}
